package com.sunfield.baseframe.base;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.sunfield.baseframe.http.HttpResult;
import com.sunfield.baseframe.util.ToastUtil;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
/**
 * Created by xiaowogua on 2016/8/15.
 */

public class BaseFragment extends Fragment {

    protected Handler handler;

    protected int pageIndex = 0;
    protected int pageSize = 10;
    protected String pageTime = null;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        handler = new Handler();
        EventBus.getDefault().register(this);
    }

    @Override
    public void onDestroy() {
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }

    @Override
    public void onResume() {
        super.onResume();
        getView().setClickable(true);
    }

    protected void toast(int msgId) {
        ToastUtil.toast(msgId);
    }

    protected void toast(CharSequence msg) {
        ToastUtil.toast(msg);
    }

    @Subscribe
    public void onHttpResult(HttpResult result){

    }
}
